package cn.shujuhai.common.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * 全局配置表
 *
 * @TableName sys_setting
 */
@EqualsAndHashCode(callSuper = true)
@TableName(value = "sys_setting")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Setting extends BaseDomain {
    /**
     *
     */
    @TableId(value = "setting_id", type = IdType.AUTO)
    private Long settingId; // 对应 setting_id

    @NotBlank(message = "配置名不能为空")
    @Size(min = 1, max = 20, message = "配置名长度应在1到20个字符之间")
    private String settingName; // 对应 setting_name

    @NotBlank(message = "配置key不能为空")
    @Pattern(regexp = "^[A-Z][A-Z0-9_]*[A-Z0-9]$", message = "配置key只能是大写字母、数字和下划线组成，且下划线不能在开头或结尾")
    private String settingKey; // 对应 settingKey

    @NotBlank(message = "配置值不能为空")
    @Size(min = 1, max = 50, message = "配置值长度应在1到50个字符之间")
    private String settingValue; // 对应 setting_value

}
